import time

class Timer:
    def __init__(self):
        self.start_time = None

    def start(self):
        """开始计时"""
        self.start_time = time.time()

    def stop(self, name):
        """结束计时，并输出耗时"""
        if self.start_time is None:
            raise ValueError("计时器未开始。请先调用start()方法开始计时。")

        end_time = time.time()
        elapsed_time_ms = (end_time - self.start_time) * 1000
        print(f"【{name} Cost：{elapsed_time_ms:.2f}ms】")